package com.tiancheng.trade.payment.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tiancheng.trade.payment.mapper.SettleMatchMapper;
import com.tiancheng.trade.payment.model.SettleMatch;
import com.tiancheng.trade.payment.service.SettleMatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author kellen
 * @date 2024-12-09 17:10
 */
@Service
public class SettleMatchServiceImpl implements SettleMatchService {
    @Autowired
    private SettleMatchMapper settleMatchMapper;

    /**
     * 批量插入
     *
     * @param list
     * @return
     */
    public int insertBatch(List<SettleMatch> list) {
        return settleMatchMapper.insertBatch(list);
    }

    /**
     * 根据某字段删除
     *
     * @param deleteBy
     * @param deleteValue
     * @return
     */
    @Override
    public Integer remove(String deleteBy, Object deleteValue) {
        QueryWrapper<SettleMatch> condition = new QueryWrapper<>();
        condition.eq(deleteBy, deleteValue);
        return settleMatchMapper.delete(condition);
    }

    @Override
    public List<Map<String, Object>> findBySubOrderIds(List<String> subOrderIds, String settleStatus) {
        return settleMatchMapper.findBySubOrderIds(subOrderIds,settleStatus);
    }

    @Override
    public List<Map<String, Object>> findApprFailAndDistSecFlowDetail(List<String> subFlowIds) {
        return settleMatchMapper.findApprFailAndDistSecFlowDetail(subFlowIds);
    }
}
